﻿
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace DualPlaneFR4Paster.Models
{
    public class AxisStatusDisp : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;
        // This method is called by the Set accessor of each property.  
        // The CallerMemberName attribute that is applied to the optional propertyName  
        // parameter causes the property name of the caller to be substituted as an argument.  
        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        private bool almState;

        public bool AlmState
        {
            get { return almState; }
            set
            {
                if (value != almState)
                {
                    almState = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private bool homeState;

        public bool HomeState
        {
            get { return homeState; }
            set
            {
                if (value != homeState)
                {
                    homeState = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private bool moveState;

        public bool MoveState
        {
            get { return moveState; }
            set
            {
                if (value != moveState)
                {
                    moveState = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private bool neglimitState;

        public bool NeglimitState
        {
            get { return neglimitState; }
            set
            {
                if (value != neglimitState)
                {
                    neglimitState = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private bool posLimitState;

        public bool PosLimitState
        {
            get { return posLimitState; }
            set
            {
                if (value != posLimitState)
                {
                    posLimitState = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private bool servoOnState;

        public bool ServoOnState
        {
            get { return servoOnState; }
            set
            {
                if (value != servoOnState)
                {
                    servoOnState = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double posPrf;

        public double PosPrf
        {
            get { return posPrf; }
            set
            {
                if (value != posPrf)
                {
                    posPrf = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double posEnc;

        public double PosEnc
        {
            get { return posEnc; }
            set
            {
                if (value != posEnc)
                {
                    posEnc = value;
                    NotifyPropertyChanged();
                }
            }
        }

    }
    public class AxisPointDisp : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;
        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        public int Id { get; set; }
        public string Name { get; set; }
        public string? Alias { get; set; }
        public int ZIndex { get; set; }
        public int RIndex { get; set; }
        public int Floor { get; set; }
        private double x;

        public double X
        {
            get { return x; }
            set
            {
                if (value != x)
                {
                    x = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double y;

        public double Y
        {
            get { return y; }
            set
            {
                if (value != y)
                {
                    y = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double z;

        public double Z
        {
            get { return z; }
            set
            {
                if (value != z)
                {
                    z = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double r;

        public double R
        {
            get { return r; }
            set
            {
                if (value != r)
                {
                    r = value;
                    NotifyPropertyChanged();
                }
            }
        }
    }
    public class AxisZSafeDisp : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;
        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        public int Id { get; set; }
        public string? Alias { get; set; }
        public string? Name { get; set; }
        public string? Unit { get; set; }
        private double zPos;

        public double ZPos
        {
            get { return zPos; }
            set
            {
                if (value != zPos)
                {
                    zPos = value;
                    NotifyPropertyChanged();
                }
            }
        }
    }
    public class ParamDisp : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;
        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        public int Id { get; set; }
        public string? Alias { get; set; }
        public string? Name { get; set; }
        public object? Value { get; set; }
        public string? Unit { get; set; }
    }
    public class FeederDisp : Feeder
    {
        public string? Name { get; set; }
        public string? Alias { get; set; }
    }
    public class SuckerDisp
    {
        public string? Name { get; set; }
        public int FeederIndex { get; set; }
        public string? Alias { get; set; }
    }
    public class LwPolylineDisp : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;
        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        public int Id { get; set; }
        public int Kind { get; set; }//0:边框 1:产品 2:Pcs
        public int Floor { get; set; }//层
        public int ProductId { get; set; }//产品ID
        private double left;

        public double Left
        {
            get { return left; }
            set
            {
                if (value != left)
                {
                    left = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double bottom;

        public double Bottom
        {
            get { return bottom; }
            set
            {
                if (value != bottom)
                {
                    bottom = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double width;

        public double Width
        {
            get { return width; }
            set
            {
                if (value != width)
                {
                    width = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double height;

        public double Height
        {
            get { return height; }
            set
            {
                if (value != height)
                {
                    height = value;
                    NotifyPropertyChanged();
                }
            }
        }


        private string borderColor;

        public string BorderColor
        {
            get { return borderColor; }
            set
            {
                if (value != borderColor)
                {
                    borderColor = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double borderThickness;

        public double BorderThickness
        {
            get { return borderThickness; }
            set
            {
                if (value != borderThickness)
                {
                    borderThickness = value;
                    NotifyPropertyChanged();
                }
            }
        }
    }
    public class DispButton : INotifyPropertyChanged
    {
        public int Id { get; set; }
        public int PcsOrder { get; set; }
        public int Index { get; set; }
        private double left;
        public double Left
        {
            get { return left; }
            set
            {
                left = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Left"));
                }
            }
        }
        private double bottom;
        public double Bottom
        {
            get { return bottom; }
            set
            {
                bottom = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Bottom"));
                }
            }
        }
        public double Width { get; set; }
        public double Height { get; set; }
        private string name;
        public string Name
        {
            get { return name; }
            set
            {
                name = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Name"));
                }
            }
        }

        public event PropertyChangedEventHandler? PropertyChanged;
    }
    public class ProductDisp : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;
        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        public int Id { get; set; }
        public bool IsUse { get; set; }//是否使用
        private string isReverse;

        public string IsReverse
        {
            get { return isReverse; }
            set
            {
                if (value != isReverse)
                {
                    isReverse = value;
                    NotifyPropertyChanged();
                }
            }
        }
        public string? Order { get; set; }
        private string direction;

        public string Direction
        {
            get { return direction; }
            set
            {
                if (value != direction)
                {
                    direction = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double startX;

        public double StartX
        {
            get { return startX; }
            set
            {
                if (value != startX)
                {
                    startX = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double startY;

        public double StartY
        {
            get { return startY; }
            set
            {
                if (value != startY)
                {
                    startY = value;
                    NotifyPropertyChanged();
                }
            }
        }
        private double endX;

        public double EndX
        {
            get { return endX; }
            set
            {
                if (value != endX)
                {
                    endX = value;
                    NotifyPropertyChanged();
                }
            }
        }

        private double endY;

        public double EndY
        {
            get { return endY; }
            set
            {
                if (value != endY)
                {
                    endY = value;
                    NotifyPropertyChanged();
                }
            }
        }
    }
    public class ProductEditDisp
    {
        public int Id { get; set; }//识别ID
        public int Direction { get; set; }//正方向或反方向扫
        public int IsReverse { get; set; }
        public double StartX { get; set; }//起点X坐标
        public double StartY { get; set; }//起点Y坐标
        public double EndX { get; set; }//终点X坐标
        public double EndY { get; set; }//终点Y坐标
    }
    public class DispClassBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;
        public void OnPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
    public class PcsDisp : DispClassBase
    {
        public int Id { get; set; }
        public int ProductId { get; set; }
        public bool IsUse { get; set; }//是否使用
        private double x;

        public double X
        {
            get { return x; }
            set { x = value; OnPropertyChanged(); }
        }
        private double y;

        public double Y
        {
            get { return y; }
            set { y = value; OnPropertyChanged(); }
        }
        private double z;

        public double Z
        {
            get { return z; }
            set { z = value; OnPropertyChanged(); }
        }
        private double r;

        public double R
        {
            get { return r; }
            set { r = value; OnPropertyChanged(); }
        }
        private double x1;

        public double X1
        {
            get { return x1; }
            set { x1 = value; OnPropertyChanged(); }
        }
        private double y1;

        public double Y1
        {
            get { return y1; }
            set { y1 = value; OnPropertyChanged(); }
        }
        private double z1;

        public double Z1
        {
            get { return z1; }
            set { z1 = value; OnPropertyChanged(); }
        }
        private double r1;

        public double R1
        {
            get { return r1; }
            set { r1 = value; OnPropertyChanged(); }
        }
        private int pickIndex;

        public int PickIndex
        {
            get { return pickIndex; }
            set { pickIndex = value; OnPropertyChanged(); }
        }

        private int pressIndex;

        public int PressIndex
        {
            get { return pressIndex; }
            set { pressIndex = value; OnPropertyChanged(); }
        }

    }
    public class PcsEditDisp
    {
        public int Id { get; set; }
        public int ProductId { get; set; }
        public double X { get; set; }
        public double Y { get; set; }
        public double R { get; set; }
        public double Z { get; set; }
        public double X1 { get; set; }
        public double Y1 { get; set; }
        public double R1 { get; set; }
        public double Z1 { get; set; }
        public int PickIndex { get; set; }
        public int PressIndex { get; set; }
    }
    public class PcsEditDeltaDisp : DispClassBase
    {
        private double x;

        public double X
        {
            get { return x; }
            set { x = value; OnPropertyChanged(); }
        }
        private double y;

        public double Y
        {
            get { return y; }
            set { y = value; OnPropertyChanged(); }
        }
        private double z;

        public double Z
        {
            get { return z; }
            set { z = value; OnPropertyChanged(); }
        }
        private double r;

        public double R
        {
            get { return r; }
            set { r = value; OnPropertyChanged(); }
        }
        private double x1;

        public double X1
        {
            get { return x1; }
            set { x1 = value; OnPropertyChanged(); }
        }
        private double y1;

        public double Y1
        {
            get { return y1; }
            set { y1 = value; OnPropertyChanged(); }
        }
        private double z1;

        public double Z1
        {
            get { return z1; }
            set { z1 = value; OnPropertyChanged(); }
        }
        private double r1;

        public double R1
        {
            get { return r1; }
            set { r1 = value; OnPropertyChanged(); }
        }
    }
}